import { createSlice } from '@reduxjs/toolkit'

const ticketslice = createSlice({
          name: 'ticket',
          initialState: {
                    dinwei: '北京',
                    chengshi: ['南京', '天津', '驻马店', '洛阳', '成都', '驻马店'],
                    lishi: []
          },
          reducers: {
                    tianjia(state, action) {
                              state.chengshi.shift()
                              state.chengshi.unshift(action.payload)
                    },
                    tianjials(state, action) {
                              console.log('aaaa')
                              state.lishi.push(action.payload)
                    },
                    qingkong(state) {
                              state.lishi = []
                    },

          }
})

export default ticketslice.reducer

export const { tianjia, tianjials, qingkong } = ticketslice.actions